/*
 * @# Follow.java 2011-12-22 下午04:30:52
 * 
 * Copyright (C) 2010 - 2011 广州羿安信息科技有限公司
 * Guangzhou ianswer information technology co. ltd.
 * 
 * All rights reserved!
 */
package com.ianswer.px.user.entity;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

/**
 * @author pananz
 * 关注
 */
public class Follow {

	public static final Long ISMUTUAL = 1L;
	public static final Long NOMUTUAL = 0L;

	private Long id;
	//关注人编号
	private Long who;
	//关注人姓名（粉丝）
	private String whoName;
	//被关注人的编号
	private Long whom;
	//被关注人所属的圈子
	private String circles;
	//备注(用于用户备注关注人的名称)
	private String remark;
	//创建时间
	private Long createdAt;
	//是否相互关注 0:否，1是
	private Long mutual;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getWho() {
		return who;
	}

	public void setWho(Long who) {
		this.who = who;
	}

	public Long getWhom() {
		return whom;
	}

	public void setWhom(Long whom) {
		this.whom = whom;
	}

	public String getWhoName() {
		return whoName;
	}

	public void setWhoName(String whoName) {
		this.whoName = whoName;
	}

	public String getCircles() {
		return circles;
	}

	public void setCircles(String circles) {
		this.circles = circles;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Long getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Long createdAt) {
		this.createdAt = createdAt;
	}

	public Long getMutual() {
		return mutual;
	}

	public void setMutual(Long mutual) {
		this.mutual = mutual;
	}

	public Follow isMutual() {
		this.setMutual(ISMUTUAL);
		return this;
	}

	public Follow noMutual() {
		this.setMutual(NOMUTUAL);
		return this;
	}

	public List<Long> getCircleIds() {
		List<Long> circleIds = new ArrayList<Long>();
		if (StringUtils.isBlank(this.circles)) {
			circleIds = null;
		} else {
			String[] circleArr = StringUtils.split(circles, ",");
			for (String circleId : circleArr) {
				circleIds.add(Long.parseLong(circleId));
			}
		}
		return circleIds;
	}

}
